﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebApplication3.Models;
using WebApplication3.DAL;

namespace WebApplication3.BLL
{
    public class EmployeeBusinessLayer
    {
        EmployeeContent content = new EmployeeContent();
        public List<Employee> GetEmployees()
        {
            //Employee emp = new Employee();
            //emp.FirstName = "johnson";
            //emp.LastName = " fernandes";
            //emp.Salary = 14000;
            //content.Employees.Add(emp);

            //emp = new Employee();
            //emp.FirstName = "michael";
            //emp.LastName = "jackson";
            //emp.Salary = 16000;
            //content.Employees.Add(emp);

            //emp = new Employee();
            //emp.FirstName = "robert";
            //emp.LastName = " pattinson";
            //emp.Salary = 20000;
            //content.Employees.Add(emp);
            //content.SaveChanges();

            List<Employee> employees = content.Employees.ToList();
            return employees;
        }

        public Employee SaveEmployee(Employee e)
        {
            content.Employees.Add(e);
            content.SaveChanges();
            return e;
        }

        public bool IsValidUser(UserDetails u)
        {
            if (u.UserName == "sargeles" && u.Password == "123456")
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}